package trip

import (
	"encoding/json"
	"fmt"
	trippd "goStudy/proto/gen/go"
	"google.golang.org/protobuf/proto"
)

func main() {
	trip := trippd.Trip{
		Start:     "abc",
		End:       "112",
		DuriedSec: 12,
		FeeCent:   13,
	}
	fmt.Print(&trip)
	fmt.Println()
	marshal, err := proto.Marshal(&trip)
	if err != nil {
		fmt.Println("出错了")
		panic(err)
	}
	fmt.Printf("%X\n", marshal)

	var trip2 trippd.Trip
	proto.Unmarshal(marshal, &trip2)
	fmt.Println(&trip2)

	bytes, _ := json.Marshal(&trip2)
	fmt.Printf("%s\n", bytes)

}
